#include "log/log.h"
#include <string.h>
#include "app_runner.h"
#include "ota_version.h"
#include "daemon_runner.h"

int main(int argc, char const *argv[])
{
    if (argc == 1)
    {
        log_error("至少要有一个参数");
        return -1;
    }
    // 判断是否是app => 运行app模块
    if (strcmp(argv[1], "app") == 0)
    {
        app_runner_run();
    }
    else if (strcmp(argv[1], "ota") == 0)
    {
        ota_version_checkUpdateDaily();
    }
    else if (strcmp(argv[1], "daemon") == 0)
    {
        daemon_runner_run();
    }
    else if (strcmp(argv[1], "version") == 0)
    {
        ota_version_printVersion();
    }
    else
    {
        log_error("参数错误，只能是app|ota|daemon|version");
    }

    return 0;
}
// gateway_test app  执行app模块
// gateway_test ota  执行ota模块
// gateway_test daemon  运行护进程模块，内部调用app模块和ota模块
// gateway_test version  查看当前版本号